package com.hzhq.contract.bean.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bson.types.Binary;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.util.Date;

/**
 * @author hzhq
 * @create 2021/3/24 6:00 下午
 * @email hzhq1255@163.com
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Document("contract_attachment")
public class Attachment implements Serializable {

    public static final String ATTACH_ID_FIELD = "_id";
    public static final String CONTRACT_ID_FIELD = "contract_id";
    public static final String CONTRACT_NAME_FIELD = "contract_name";
    public static final String ATTACH_NAME_FIELD = "attach_name";
    public static final String MD5_FIELD = "md5";
    public static final String SIZE_FIELD = "size";
    public static final String CONTENT_FIELD = "content";
    public static final String CONTENT_TYPE_FIELD = "content_type";
    public static final String PATH_FIELD = "path";
    public static final String UPLOAD_TIME_FIELD = "upload_time";
    public static final String DELETED_FIELD = "deleted";

    @Id
    private ObjectId attachId;
    @ApiModelProperty(value = "所属合同")
    @Field(CONTRACT_ID_FIELD)
    private ObjectId contractId;
    @ApiModelProperty(value = "附件名称")
    @Field(ATTACH_NAME_FIELD)
    private String attachName;
    @ApiModelProperty(value = "文件md5值")
    @Field(MD5_FIELD)
    private String md5;
    @ApiModelProperty(value = "文件大小")
    @Field(SIZE_FIELD)
    private Long size;
    @ApiModelProperty(value = "文件内容")
    @Field(CONTENT_FIELD)
    private Binary content;
    @ApiModelProperty(value = "数据类型")
    @Field(CONTENT_TYPE_FIELD)
    private String contentType;
    @ApiModelProperty(value = "附件路径")
    @Field(PATH_FIELD)
    private String path;
    @ApiModelProperty(value = "上传时间")
    @Field(UPLOAD_TIME_FIELD)
    private Date uploadTime;
    @ApiModelProperty(value = "删除")
    @Field(DELETED_FIELD)
    private Integer deleted;


}
